<template>
  <div class="page">
    <div class="wrapper">
      <div class="logo">此处应有LOGO</div>
      <div class="button_group">
        <template v-if="showLogin">
          <a-button type="primary" shape="round" @click="handleRegister">
            注册
          </a-button>
        </template>

        <template v-else>
          <a-button type="primary" shape="round" @click="handleLogin">
            登录
          </a-button>
        </template>
        <a-button type="primary" shape="round" @click="handleGoHome">
          返回首页
        </a-button>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { useLoginBasicStore } from '@/store/login';
import { computed, defineComponent } from 'vue';
export default defineComponent({
  setup() {
    // store
    // 登录基础store
    const loginBasicState = useLoginBasicStore();

    // conputed
    // 是否展示登录口
    const showLogin = computed<boolean>(() => {
      return loginBasicState.showLogin;
    });

    // event
    // 点击事件 返回首页
    const handleGoHome = () => {
      window.location.href = 'http://www.liuzhiwei.xyz/';
    };

    // 点击事件 注册
    const handleRegister = () => {
      loginBasicState.changeShowLogin(false);
    };

    // 点击事件 登录
    const handleLogin = () => {
      loginBasicState.changeShowLogin(true);
    };

    return { handleGoHome, showLogin, handleRegister, handleLogin };
  },
});
</script>
<style lang="less" scoped>
.wrapper {
  width: 100%;
  height: 95px;
  padding: 0 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;

  .logo {
    font-size: 24px;
    line-height: 24px;
    font-weight: bold;
    color: #fca428;
    padding: 40px 0;
  }
  .button_group {
    button {
      width: 90px;
      height: 40px;
      margin-left: 16px;
    }
  }
}
</style>
